package ar.fiuba.tp7552.buildadmin.tags;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts2.components.Component;
import org.apache.struts2.views.jsp.ComponentTagSupport;

import com.opensymphony.xwork2.util.ValueStack;

public class ConfirmDialogTag extends ComponentTagSupport {
	
	private String title;
	private String confirmAction;
	private String cancelAction;
	private String urlBase;
	
	@Override
	public Component getBean(ValueStack arg0, HttpServletRequest arg1, HttpServletResponse arg2) {
		urlBase=arg1.getContextPath();
		return new ConfirmDialog(arg0);
	}
	
	protected void populateParams() {
        super.populateParams();
        ConfirmDialog dialog = (ConfirmDialog) component;
        dialog.setTitle(title);
        dialog.setConfirmAction(confirmAction);
        dialog.setCancelAction(cancelAction);
        dialog.setUrlBase(urlBase);
    }

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getConfirmAction() {
		return confirmAction;
	}

	public void setConfirmAction(String confirmAction) {
		this.confirmAction = confirmAction;
	}

	public String getCancelAction() {
		return cancelAction;
	}

	public void setCancelAction(String cancelAction) {
		this.cancelAction = cancelAction;
	}
}
